/*
 * Copyright (C) 2018 Spreadtrum Communications Inc.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef __GSP_R9P0_COMMON_H__
#define __GSP_R9P0_COMMON_H__
#include "v1_0/display_composer_type.h"
namespace OHOS {
namespace HDI {
namespace DISPLAY {
using namespace OHOS::HDI::Display::Composer::V1_0;
int get_tap_var0(int srcPara, int destPara);
bool checkRangeSize(IRect *srcRect, IRect *dstRect);
enum gsp_rot_angle rotationTypeConvert(TransformType value);
int convertImgFormat(PixelFormat enColorFmt, struct gsp_layer_user *common,
                    struct gsp_r9p0_img_layer_params *params, uint32_t w, uint32_t h);
int osdFormatConvert(PixelFormat enColorFmt, struct gsp_r9p0_osd_layer_params *params, struct gsp_layer_user *common);
int dstFormatConvert(PixelFormat enColorFmt, struct gsp_r9p0_des_layer_params *params, struct gsp_layer_user *common,
                    uint32_t w, uint32_t h);
bool isVideoLayerImg(int format);
bool isVideoLayerOsd(int format);
bool imgCheckOddBoundary(IRect *srcRect, int32_t format);
bool isLandScapeTransform(enum gsp_rot_angle rot);
bool checkScaleSize(IRect *srcRect, IRect *dstRect,
                    enum gsp_rot_angle rot, bool inFBC,
                    int protectLayerNum);
bool checkScale(IRect *srcRect, IRect *dstRect,
                enum gsp_rot_angle rot, bool inFBC,
                int protectLayerNum);
bool checkInputRotation(IRect *srcRect, IRect *dstRect, enum gsp_rot_angle rot,
                        int32_t format, int protectLayerNum);
bool needScale(IRect *srcRect, IRect *dstRect,
                enum gsp_rot_angle rot);
void configScale(IRect *srcRect, IRect *dstRect, enum gsp_rot_angle rot, 
                    struct  gsp_r9p0_img_layer_params *params);
int rotAdjust(struct gsp_r9p0_cfg_user *cmd_info, uint32_t transform);
bool miscCfgParcel(struct gsp_r9p0_misc_cfg_user *r9p0_misc_cfg, int mode_type, uint32_t transform, 
                    uint32_t w, uint32_t h);

extern struct gsp_r9p0_capability mCapability;
extern uint16_t mLayerCount;
extern bool mInputRotMode;
} // namespace DISPLAY
} // namespace HDI
} // namespace OHOS
#endif